<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="../base.jsp"%>
<!DOCTYPE html>
<html>

<head>
    <!-- 页面meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>数据 - AdminLTE2定制版</title>
    <meta name="description" content="AdminLTE2定制版">
    <meta name="keywords" content="AdminLTE2定制版">
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
    <!-- 页面meta /-->
    <script src="${ctx}/plugins/jQuery/jquery-2.2.3.min.js"></script>
</head>
<script>
    function deleteById() {
        //当勾选的数量为1的时候,返回的值就是某个企业的id; 否则返回值就是undefined
        var id = getCheckId()

        //id为null," ,0,undefined,NaN的时候 if判断的结果就是false; 否则就是true
        if(id) {
            if(confirm("你确认要删除此条记录吗？")) {
                location.href="${ctx}/mill/delete.do?id="+id;
            }
        }else{
            alert("请勾选待处理的记录，且每次只能勾选一个")
        }
    }
</script>
<body>
<div id="frameContent" class="content-wrapper" style="margin-left:0px;">
    <section class="content-header">
        <h1>
            基础信息
            <small>厂家信息</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="all-admin-index.html"><i class="fa fa-dashboard"></i> 首页</a></li>
        </ol>
    </section>
    <!-- 内容头部 /-->

    <!-- 正文区域 -->
    <section class="content">

        <!-- .box-body -->
        <div class="box box-primary">
            <div class="box-header with-border">
                <h3 class="box-title">厂家列表</h3>
            </div>

            <div class="box-body">

                <!-- 数据表格 -->
                <div class="table-box">

                    <!--工具栏-->
                    <div class="pull-left">
                        <div class="form-group form-inline">
                            <div class="btn-group">
                                <button type="button" class="btn btn-default" title="新建" onclick='location.href="${ctx}/mill/toAdd.do"'><i class="fa fa-file-o"></i> 新建</button>
                                <button type="button" class="btn btn-default" title="删除" onclick='deleteById()'><i class="fa fa-trash-o"></i> 删除</button>
                                <button type="button" class="btn btn-default" title="刷新" onclick="window.location.reload();"><i class="fa fa-refresh"></i> 刷新</button>
                            </div>
                        </div>
                    </div>
                    <div class="box-tools pull-right">
                        <div class="has-feedback">
                            <input type="text" class="form-control input-sm" placeholder="搜索">
                            <span class="glyphicon glyphicon-search form-control-feedback"></span>
                        </div>
                    </div>
                    <!--工具栏/-->

                    <!--数据列表-->
                    <table id="dataList" class="table table-bordered table-striped table-hover dataTable">
                        <thead>
                        <tr>
                            <th class="" style="padding-right:0px;">

                            </th>
                            <th class="sorting">厂家类型</th>
                            <th class="sorting">厂家全称</th>
                            <th class="sorting">厂家简称</th>
                            <th class="sorting">联系人</th>
                            <th class="sorting">联系方式</th>
                            <th class="sorting">地址</th>
                            <th class="sorting">验货员</th>
                            <th class="sorting">说明</th>
                            <th class="sorting">排序号</th>
                            <th class="sorting">状态</th>
                            <%--<th class="sorting">余额</th>--%>
                            <th class="text-center">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${page.list}" var="factory">
                            <tr>
                                <td><input name="id" value="${factory.id}" type="checkbox"></td>
                                <td>${factory.ctype}</td>
                                <td>${factory.fullName}</td>
                                <td>${factory.factoryName}</td>
                                <td>${factory.contacts}</td>
                                <td>${factory.phone}</td>
                                <td>${factory.address}</td>
                                <td>${factory.inspector}</td>
                                <td>${factory.remark}</td>
                                <td>${factory.orderNo}</td>
                                <td>${factory.state ==0?'未审核':'已审核'}</td>
                                <%--<td class="text-center">${item.balance}</td>--%>
                                <td class="text-center">
                                    <button type="button" class="btn bg-olive btn-xs" onclick='location.href="${ctx}/mill/toUpdate.do?id=${factory.id}"'>编辑</button>
                                </td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- /.box-body -->

            <!-- .box-footer-->
            <%--
            <div class="box-footer">
                <form action="${ctx}/company/list.do" method="post" id="pageFormId">
                    &lt;%&ndash;添加一个隐藏域,存放要查看的页码&ndash;%&gt;
                    <input type="hidden" name="page" id="pageNumId">
                    <div class="pull-left">
                        <div class="form-group form-inline">
                            总共${page.pages} 页，共${page.total}条数据。 每页
                            <select class="form-control" name="size" onchange="goPage(1)">
                                <option value="5"  ${page.pageSize=='5'?'selected':''}>5</option>
                                <option value="10" ${page.pageSize=='10'?'selected':''}>10</option>
                            </select> 条
                        </div>
                    </div>

                    <div class="box-tools pull-right">
                        <ul class="pagination">
                            <li>
                                <a href="javascript:goPage(1)" aria-label="Previous">首页</a>
                            </li>
                            <li><a href="javascript:goPage(${page.prePage})">上一页</a></li>
                            <c:forEach begin="${page.navigateFirstPage}" end="${page.navigateLastPage}" var="n">
                                <li><a href="javascript:goPage(${n})">${n}</a></li>
                            </c:forEach>
                            <li><a href="javascript:goPage(${page.nextPage})">下一页</a></li>
                            <li>
                                <a href="javascript:goPage(${page.pages})" aria-label="Next">尾页</a>
                            </li>
                        </ul>
                    </div>
                </form>
                <script>
                    function goPage(page) {
                        //1.将传递过来的page设置给隐藏域
                        $("#pageNumId").val(page);
                        //2.获取表单,让表单提交
                        $("#pageFormId").submit();
                    }
                </script>
            </div>
--%>

                    <div class="box-footer">
                        <jsp:include page="../common/page.jsp"></jsp:include>
                    </div>
            <!-- /.box-footer-->

        </div>
    </section>
</div>
</body>

</html>